home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / util / misc / adpcm_pa.lha / FP_ADPCM / DeliPlayers / Source / DeliPlayer.h < prev    next >
C/C++ Source or Header  |  1995-10-05  |  16KB  |  396 lines

  1. /**
  2.  **  $Filename: misc/DeliPlayer.h $
  3.  **  $Release: 2.0 $
  4.  **  $Revision: 2.15$
  5.  **  $Date: 22/06/95$
  6.  **
  7.  **  Definitions and Macros for creating DeliTracker Playermodules
  8.  **
  9.  **  (C) Copyright 1991, 1992, 1993, 1994, 1995 Delirium Softdesign
  10.  **      All Rights Reserved
  11.  **
  12.  **/
  13.  
  14. #ifndef    DELITRACKER_PLAYER_H
  15. #define DELITRACKER_PLAYER_H
  16.  
  17. #ifndef EXEC_TYPES_H
  18. #include <exec/types.h>
  19. #endif
  20.  
  21. #ifndef EXEC_PORTS_H
  22. #include <exec/ports.h>
  23. #endif
  24.  
  25. #ifndef UTILITY_TAGITEM_H
  26. #include <utility/tagitem.h>
  27. #endif
  28.  
  29. #ifndef INTUITION_SCREENS_H
  30. #include <intuition/screens.h>
  31. #endif
  32.  
  33. /* --------------------------------------------------------------------------- */
  34.  
  35. #define DELIVERSION 17            /* Current Version of DeliTracker */
  36. #define DELIREVISION 4            /* Current Revision of DeliTracker */
  37.  
  38. /* -------------- The declarations for the interface functions --------------- */
  39.  
  40. extern __asm APTR dt_GetListDataAddr(register __d0 ULONG num);
  41. extern __asm ULONG dt_GetListDataSize(register __d0 ULONG num);
  42. extern __asm BOOL dt_LoadFile(void);
  43. extern __asm void dt_CopyDir(void);
  44. extern __asm void dt_CopyFile(void);
  45. extern __asm void dt_CopyString(register __a0 STRPTR string);
  46. extern __asm BOOL dt_AudioAlloc(void);
  47. extern __asm void dt_AudioFree(void);
  48. extern __asm void dt_StartInt(void);
  49. extern __asm void dt_StopInt(void);
  50. extern __asm void dt_SongEnd(void);
  51. extern __asm void dt_CutSuffix(void);
  52. extern __asm void dt_SetTimer(void);
  53. extern __asm void dt_WaitAudioDMA(void);
  54. extern __asm struct Screen *dt_LockScreen(void);
  55. extern __asm void dt_UnlockScreen(void);
  56. extern __asm void dt_NotePlayer(void);
  57. extern __asm APTR dt_AllocListData(register __d0 ULONG size, register __d1 ULONG memflags);
  58. extern __asm void dt_FreeListData(register __a1 APTR memblock);
  59.  
  60. /* ------------------------ Player Function Offsets -------------------------- */
  61.  
  62. struct DeliTrackerPlayer {
  63.     ULONG RTS_code;
  64.     UBYTE ID[8];
  65.     struct TagItem *TagArray;
  66. };
  67.  
  68. /* The TagItem ID's (ti_Tag values) for the player interface follow. */
  69.  
  70. #define DTP_Dummy    (TAG_USER + 0x4454)
  71.  
  72. #define DTP_InternalPlayer    (DTP_Dummy)        /* obsolete */
  73. #define DTP_CustomPlayer    (DTP_Dummy + 1)        /* player is a customplayer */
  74.  
  75. #define DTP_RequestDTVersion    (DTP_Dummy + 2)        /* minimum DeliTracker version needed */
  76. #define DTP_RequestKickVersion    (DTP_Dummy + 3)        /* minimum KickStart version needed */
  77.  
  78. #define DTP_PlayerVersion    (DTP_Dummy + 4)        /* actual player version & revision */
  79. #define DTP_PlayerName        (DTP_Dummy + 5)        /* name of this player */
  80. #define DTP_Creator        (DTP_Dummy + 6)        /* misc string */
  81.  
  82. #define DTP_Check1        (DTP_Dummy + 7)        /* Check Format before loading */
  83. #define DTP_Check2        (DTP_Dummy + 8)        /* Check Format after file is loaded */
  84. #define DTP_ExtLoad        (DTP_Dummy + 9)        /* Load additional files */
  85. #define DTP_Interrupt        (DTP_Dummy + 10)    /* Interrupt routine */
  86. #define DTP_Stop        (DTP_Dummy + 11)    /* Clear Patterncounter */
  87. #define DTP_Config        (DTP_Dummy + 12)    /* Config Player */
  88. #define DTP_UserConfig        (DTP_Dummy + 13)    /* User-Configroutine */
  89. #define DTP_SubSongRange    (DTP_Dummy + 14)    /* Get min&max subsong number */
  90.  
  91. #define DTP_InitPlayer        (DTP_Dummy + 15)    /* Initialisize the Player */
  92. #define DTP_EndPlayer        (DTP_Dummy + 16)    /* Player clean up */
  93. #define DTP_InitSound        (DTP_Dummy + 17)    /* Soundinitialisation routine */
  94. #define DTP_EndSound        (DTP_Dummy + 18)    /* End sound */
  95. #define DTP_StartInt        (DTP_Dummy + 19)    /* Start interrupt */
  96. #define DTP_StopInt        (DTP_Dummy + 20)    /* Stop interrupt */
  97.  
  98. #define DTP_Volume        (DTP_Dummy + 21)    /* Set Volume */
  99. #define DTP_Balance        (DTP_Dummy + 22)    /* Set Balance */
  100. #define DTP_Faster        (DTP_Dummy + 23)    /* Incease playspeed */
  101. #define DTP_Slower        (DTP_Dummy + 24)    /* Decrease playspeed */
  102. #define DTP_NextPatt        (DTP_Dummy + 25)    /* Jump to next pattern */
  103. #define DTP_PrevPatt        (DTP_Dummy + 26)    /* Jump to previous pattern */
  104. #define DTP_NextSong        (DTP_Dummy + 27)    /* Play next subsong */
  105. #define DTP_PrevSong        (DTP_Dummy + 28)    /* Play previous subsong */
  106.  
  107.     /*--- functions in revision 14 or higher (distributed as Release 1.35) --- */
  108.  
  109. #define DTP_SubSongTest        (DTP_Dummy + 29)    /* Test, if given subsong is vaild */
  110.  
  111.     /*--- functions in revision 16 or higher (distributed as Release 2.01) --- */
  112.  
  113. #define DTP_NewSubSongRange    (DTP_Dummy + 30)    /* enhanced replacement for DTP_SubSongRange */
  114.  
  115. #define DTP_DeliBase        (DTP_Dummy + 31)    /* the address of a pointer where DT */
  116.                                                 /* stores a pointer to the DeliGlobals */
  117.  
  118. #define DTP_Flags        (DTP_Dummy + 32)    /* misc Flags (see below) */
  119.  
  120. #define DTP_CheckLen        (DTP_Dummy + 33)    /* Length of the Check Code */
  121.  
  122. #define DTP_Description        (DTP_Dummy + 34)    /* misc string */
  123.  
  124. #define DTP_Decrunch        (DTP_Dummy + 35)    /* pointer to Decrunch Code */
  125. #define DTP_Convert        (DTP_Dummy + 36)    /* pointer to Converter Code */
  126.  
  127. #define DTP_NotePlayer        (DTP_Dummy + 37)    /* pointer to a NotePlayer Structure */
  128. #define DTP_NoteStruct        (DTP_Dummy + 38)    /* the address of a pointer to the */
  129.                                                 /* NoteStruct Structure */
  130. #define DTP_NoteInfo        (DTP_Dummy + 39)    /* a pointer where DT stores a pointer */
  131.                                                 /* to the current NoteStruct Structure */
  132. #define DTP_NoteSignal        (DTP_Dummy + 40)    /* pointer to NoteSignal code */
  133.  
  134. #define DTP_Process        (DTP_Dummy + 41)    /* pointer to process entry code */
  135. #define DTP_Priority        (DTP_Dummy + 42)    /* priority of the process */
  136. #define DTP_StackSize        (DTP_Dummy + 43)    /* stack size of the process */
  137. #define DTP_MsgPort        (DTP_Dummy + 44)    /* a pointer where DT stores a pointer */
  138.                                                 /* to a port to send its messages */
  139.  
  140. #define DTP_Appear        (DTP_Dummy + 45)    /* open your window, if you can */
  141. #define DTP_Disappear        (DTP_Dummy + 46)    /* go dormant */
  142.  
  143. #define DTP_ModuleName        (DTP_Dummy + 47)    /* get the name of the current module */
  144. #define DTP_FormatName        (DTP_Dummy + 48)    /* get the name of the module format */
  145. #define DTP_AuthorName        (DTP_Dummy + 49)    /* not implemented yet */
  146.  
  147.     /*--- functions in revision 17 or higher (distributed as Release 2.07) --- */
  148.  
  149. #define DTP_InitNote        (DTP_Dummy + 50)    /* NoteStruct initialization */
  150.  
  151. #define    DTP_NoteAllocMem    (DTP_Dummy + 51)    /* allocates memory for module */
  152.  
  153. #define    DTP_NoteFreeMem        (DTP_Dummy + 52)    /* frees module-memory */
  154.  
  155. #define    DTP_PlayerInfo        (DTP_Dummy + 53)    /* a pointer where DT stores a pointer */
  156.                             /* to the current Player Taglist */
  157.  
  158. #define    DTP_Patterns        (DTP_Dummy + 54)    /* FPTR to a pattern-count routine */
  159.  
  160. #define    DTP_Duration        (DTP_Dummy + 55)    /* FPTR to a duration calc routine */
  161.  
  162. #define    DTP_SampleData        (DTP_Dummy + 56)    /* FPTR to a sample-info routine */
  163.  
  164. #define    DTP_MiscText        (DTP_Dummy + 57)    /* FPTR to a misc-text routine */
  165.  
  166. /* end of player interface enumeration */
  167.  
  168.  
  169. /* --- various flags --------------------------------------------------------- */
  170.  
  171. #define PLYB_CUSTOM 0        /* player is a customplayer */
  172. #define PLYF_CUSTOM (1<<0)
  173. #define PLYB_SONGEND 1        /* player supports songend */
  174. #define PLYF_SONGEND (1<<1)
  175.  
  176.     /*--- flags defined in revision 17 or higher (distributed as Release 2.07) --- */
  177.  
  178. #define PLYB_ANYMEM 2        /* modules of this player don't require chipmem */
  179. #define PLYF_ANYMEM (1<<2)
  180.  
  181. /* --- DeliTracker message --------------------------------------------------- */
  182.  
  183. struct DeliMessage {
  184.     struct Message Message;
  185.     ULONG (*Function)(void);
  186.     ULONG Result;
  187.     ULONG    DTMN_ArgumentD0;
  188.     ULONG    DTMN_ArgumentA0;
  189. };
  190.  
  191. /* --- DeliTracker NotePlayer ------------------------------------------------ */
  192.  
  193. struct NotePlayer {
  194.     UWORD    npl_LeftChannels;    /* max. number of left channels this noteplayer supports */
  195.     UWORD    npl_RightChannels;    /* max. number of right channels this noteplayer supports */
  196.     ULONG    npl_Flags;        /* misc flags (see below) */
  197.     ULONG    npl_MaxFrequency;    /* max. frequency this noteplayer supports (-1 if unlimited) */
  198.     ULONG    npl_Memory;        /* memory type for samples (e.g. MEMF_CHIP) */
  199.     UBYTE    npl_Reserved[16];    /* reserved for future use (must be 0 for now) */
  200. };
  201.  
  202. #define    NPLB_CPUintensive 0        /* the NotePlayer needs much cpu-power */
  203. #define    NPLF_CPUintensive (1<<0)    /* the NotePlayer needs much cpu-power */
  204.  
  205. #define    NPLB_Reverse 8            /* little endian byte ordering */
  206. #define    NPLF_Reverse (1<<8)        /* little endian byte ordering */
  207. #define    NPLB_Signed 9            /* signed linear (2's complement) samples supported */
  208. #define    NPLF_Signed (1<<9)        /* signed linear (2's complement) samples supported */
  209. #define    NPLB_Unsigned 10        /* unsigned linear samples supported */
  210. #define    NPLF_Unsigned (1<<10)    /* unsigned linear samples supported */
  211. #define    NPLB_Ulaw 11            /* U-law (logarithmic) samples supported */
  212. #define    NPLF_Ulaw (1<<11)        /* U-law (logarithmic) samples supported */
  213. #define    NPLB_Alaw 12            /* A-law (logarithmic) samples supported */
  214. #define    NPLF_Alaw (1<<12)        /* A-law (logarithmic) samples supported */
  215. #define    NPLB_Float 13            /* IEEE float samples supported */
  216. #define    NPLF_Float (1<<13)        /* IEEE float samples supported */
  217.  
  218. #define    NPLB_7Bit 16            /* 7-bit samples supported */
  219. #define    NPLF_7Bit (1<<16)        /* 7-bit samples supported */
  220. #define    NPLB_8Bit 17            /* byte samples supported */
  221. #define    NPLF_8Bit (1<<17)        /* byte samples supported */
  222. #define    NPLB_16Bit 18            /* 16-bit word samples supported */
  223. #define    NPLF_16Bit (1<<18)        /* 16-bit word samples supported */
  224. #define    NPLB_24Bit 19            /* 24-bit data samples supported */
  225. #define    NPLF_24Bit (1<<19)        /* 24-bit data samples supported */
  226. #define    NPLB_32Bit 20            /* longword samples supported */
  227. #define    NPLF_32Bit (1<<20)        /* longword samples supported */
  228. #define    NPLB_64Bit 21            /* quadword samples supported */
  229. #define    NPLF_64Bit (1<<21)        /* quadword samples supported */
  230.  
  231. #define    NPLD_TypeMask (NPLF_Reverse|NPLF_Signed|NPLF_Unsigned|NPLF_Ulaw|NPLF_Alaw|NPLF_Float)
  232. #define    NPLD_SizeMask (NPLF_7Bit|NPLF_8Bit|NPLF_16Bit|NPLF_24Bit|NPLF_32Bit|NPLF_64Bit)
  233.  
  234.  
  235. struct NoteStruct {
  236.     APTR    nst_Channels;        /* pointer to a list of notechannels */
  237.     ULONG    nst_Flags;        /* misc flags (see below) */
  238.     ULONG    nst_MaxFrequency;    /* max. frequency of this player (28,867 Hz in DMA mode) */
  239.     UWORD    nst_MaxVolume;        /* max. volume of this player (in most cases 64) */
  240.     UBYTE    nst_Reserved[18];    /* reserved for future use (must be 0 for now) */
  241. };
  242.  
  243. #define    NSTB_Dummy 0            /* only a dummy-NoteStruct (no NotePlayer needed) */
  244. #define    NSTF_Dummy (1<<0)
  245. #define    NSTB_Period 1            /* Amiga period supplied instead of frequency */
  246. #define    NSTF_Period (1<<1)
  247. #define    NSTB_ExtPeriod 2        /* Extended period (period*4) supplied instead of frequency */
  248. #define    NSTF_ExtPeriod (1<<2)
  249. #define    NSTB_NTSCTiming 3        /* Period/ExtPeriod supplied in NTSC instead of PAL */
  250. #define    NSTF_NTSCTiming (1<<3)
  251. #define    NSTB_EvenLength 4        /* Samplelength supplied as WORD instead of LONG */
  252. #define    NSTF_EvenLength (1<<4)
  253. #define    NSTB_AllRepeats 5        /* play Repeats even if no One-Shot part was played yet */
  254. #define    NSTF_AllRepeats (1<<5)
  255.  
  256. #define    NSTB_Reverse 8            /* little endian byte ordering */
  257. #define    NSTF_Reverse (1<<8)
  258. #define    NSTB_Signed 9            /* sample data is signed linear (2's complement) */
  259. #define    NSTF_Signed (1<<9)
  260. #define    NSTB_Unsigned 10        /*       -"-      unsigned linear */
  261. #define    NSTF_Unsigned (1<<10)
  262. #define    NSTB_Ulaw 11            /*       -"-      U-law (logarithmic) */
  263. #define    NSTF_Ulaw (1<<11)
  264. #define    NSTB_Alaw 12            /*       -"-      A-law (logarithmic) */
  265. #define    NSTF_Alaw (1<<12)
  266. #define    NSTB_Float 13            /*       -"-      IEEE floats */
  267. #define    NSTF_Float (1<<13)
  268.  
  269. #define    NSTB_7Bit 16            /* sample data is in 7-bit format */
  270. #define    NSTF_7Bit (1<<16)
  271. #define    NSTB_8Bit 17            /*        -"-        bytes */
  272. #define    NSTF_8Bit (1<<17)
  273. #define    NSTB_16Bit 18            /*        -"-        16-bit words */
  274. #define    NSTF_16Bit (1<<18)
  275. #define    NSTB_24Bit 19            /*        -"-        24-bit data */
  276. #define    NSTF_24Bit (1<<19)
  277. #define    NSTB_32Bit 20            /*        -"-        longwords */
  278. #define    NSTF_32Bit (1<<20)
  279. #define    NSTB_64Bit 21            /*        -"-        quadwords */
  280. #define    NSTF_64Bit (1<<21)
  281.  
  282. #define    NSTD_TypeMask (NSTF_Reverse|NSTF_Signed|NSTF_Unsigned|NSTF_Ulaw|NSTF_Alaw|NSTF_Float)
  283. #define    NSTD_SizeMask (NSTF_7Bit|NSTF_8Bit|NSTF_16Bit|NSTF_24Bit|NSTF_32Bit|NSTF_64Bit)
  284.  
  285.  
  286. struct NoteChannel {
  287.     APTR    nch_NextChannel;    /* next channel in the list (NULL if last) */
  288.     ULONG    nch_NotePlayer;        /* for use by the noteplayer (the deliplayer must ignore this) */
  289.     WORD    nch_Reserved0;        /* reserved for future use (must be 0 for now) */
  290.     UBYTE    nch_Private;        /* just what it says */
  291.     UBYTE    nch_Changed;        /* what has changed since last call */
  292.     WORD    nch_StereoPos;        /* set this field when the InitNote function is called */
  293.     WORD    nch_Stereo;        /* describes "where" this channel is supposed to play */
  294.     APTR    nch_SampleStart;    /* ^sampledata */
  295.     ULONG    nch_SampleLength;    /* size of sample */
  296.     APTR    nch_RepeatStart;    /* ^repeat part of sample */
  297.     ULONG    nch_RepeatLength;    /* size of repeat part */
  298.     ULONG    nch_Frequency;        /* frequency (or period) of sample */
  299.     UWORD    nch_Volume;        /* volume of sample */
  300.     UBYTE    nch_Reserved1[26];    /* reserved for future use (must be 0 for now) */
  301. };
  302.  
  303. #define    NCHB_Stereo 0            /* pan position of channel has changed (???) */
  304. #define    NCHF_Stereo (1<<0)
  305. #define    NCHB_Sample 1            /* one-shot part of sample has changed */
  306. #define    NCHF_Sample (1<<1)
  307. #define    NCHB_Repeat 2            /* repeat part of sample has changed */
  308. #define    NCHF_Repeat (1<<2)
  309. #define    NCHB_Frequency 3        /* frequency has changed */
  310. #define    NCHF_Frequency (1<<3)
  311. #define    NCHB_Volume 4            /* volume (or pan position ???) has changed */
  312. #define    NCHF_Volume (1<<4)
  313. #define    NCHB_Trigger 5            /* trigger sample */
  314. #define    NCHF_Trigger (1<<5)
  315. #define    NCHB_Restart 6            /* restart sample */
  316. #define    NCHF_Restart (1<<6)
  317.  
  318. #define    NCHB_Loop 16            /* sample has looped at least once (set by DeliTracker) */
  319. #define    NCHF_Loop (1<<16)
  320.  
  321. #define    NCHB_Private0 8            /* private internal use! */
  322. #define    NCHF_Private0 (1<<8)
  323. #define    NCHB_Private1 9            /* private internal use! */
  324. #define    NCHF_Private1 (1<<9)
  325.  
  326.  
  327. #define    NCHD_Ignore -32768        /* ignore this notechannel */
  328. #define    NCHD_Balanced 0            /* play balanced on both sides */
  329. #define    NCHD_FarLeft -32767        /* play only on left speaker */
  330. #define    NCHD_FarRight +32767        /* play only on right speaker */
  331.  
  332.  
  333. /* ---------------------------- Global Variables ------------------------------ */
  334.  
  335. struct DeliTrackerGlobals {
  336.  
  337.     /* ------ if you use dtg_AslBase, make sure that */
  338.     /* ------ DTP_RequestDTVersion is at least 13 ! */
  339.  
  340.     struct Library *AslBase;        /* library base, don't CloseLibrary()!! */
  341.  
  342.     struct Library *DOSBase;        /* library base -"- */
  343.     struct IntuitionBase *IntuitionBase;    /* library base -"- */
  344.     struct GfxBase *GfxBase;        /* library base -"- */
  345.     struct Library *GadToolsBase;        /* librarybase -"- (NULL for Kick 1.3 and below) */
  346.     APTR ReservedLibraryBase;        /* reserved for future use */
  347.  
  348.     STRPTR    DirArrayPtr;        /* Ptr to the directory of the current module */
  349.     STRPTR    FileArrayPtr;        /* Ptr to the filename of the current module */
  350.     STRPTR    PathArrayPtr;        /* Ptr to PathArray (e.g used in LoadFile()) */
  351.  
  352.     APTR    ChkData;        /* pointer to the module to be checked */
  353.     ULONG    ChkSize;        /* size of the module */
  354.  
  355.     UWORD    SndNum;            /* current sound number */
  356.     UWORD    SndVol;            /* volume (ranging from 0 to 64) */
  357.     UWORD    SndLBal;        /* left volume (ranging from 0 to 64) */
  358.     UWORD    SndRBal;        /* right volume (ranging from 0 to 64) */
  359.     UWORD    LED;            /* filter (0 if the LED is off) */
  360.     UWORD    Timer;            /* timer-value for the CIA-Timers */
  361.  
  362.     APTR    dtg_GetListData;
  363.     APTR    dtg_LoadFile;
  364.     APTR    dtg_CopyDir;
  365.     APTR    dtg_CopyFile;
  366.     APTR    dtg_CopyString;
  367.     APTR    dtg_AudioAlloc;
  368.     APTR    dtg_AudioFree;
  369.     APTR    dtg_StartInt;
  370.     APTR    dtg_StopInt;
  371.     APTR    dtg_SongEnd;        /* safe to call from interrupt code ! */
  372.     APTR    dtg_CutSuffix;
  373.  
  374.     /* ------ extension in revision 14 */
  375.  
  376.     APTR    dtg_SetTimer;        /* safe to call from interrupt code ! */
  377.  
  378.     /* ------ extension in revision 15 */
  379.  
  380.     APTR    dtg_WaitAudioDMA;    /* safe to call from interrupt code ! */
  381.  
  382.     /* ------ extension in revision 16 */
  383.  
  384.     APTR    dtg_LockScreen;
  385.     APTR    dtg_UnlockScreen;
  386.     APTR    dtg_NotePlayer;        /* safe to call from interrupt code ! */
  387.     APTR    dtg_AllocListData;
  388.     APTR    dtg_FreeListData;
  389.  
  390.     APTR    dtg_Reserved1;        /* do not use !!! */
  391.     APTR    dtg_Reserved2;        /* do not use !!! */
  392.     APTR    dtg_Reserved3;        /* do not use !!! */
  393. };
  394.  
  395. #endif
  396.